<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>发送私信</title>
	<link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css">
</head>
<body>
<div class="modal-dialog">
  <div class="">
    <div class="modal-body">
      <form action="" method="post">
        <input id="nickName" class="form-control" type="text" name="nickName" readonly="readonly" >
        <!--  
        <div class="aw-dropdown">
          <p class="title">没有找到相关结果</p>
          <ul class="aw-dropdown-list"></ul>
        </div>-->
        <textarea class="form-control" name="message" id="message" rows="3" placeholder="私信内容..." style="margin-top: 15px;"></textarea>
      </form>
    </div>
    <div class="modal-footer">
      <button class="btn btn-large btn-success" onclick="submitData();return false;">发送</button>
      <p style="margin-top: 10px;"><font id="errorInfo" color="red"></font></p>
    </div>
  </div>
</div>

<script type="text/javascript" src="/static/jquery/jquery.min-v1.12.4.js"></script>
<script type="text/javascript" src="/static/layer/layer/layer.js"></script>
<script type="text/javascript">

	function submitData(){
		var uid=getQueryVariable("uid");
		var message=$("#message").val().trim()
			if (message=="") { 
		　　　　     　　 $("#errorInfo").text("请输入内容！");
				  $("#message").focus();
		　　　　　　      return false; 
		　　　}
		   $.post("/my/sendUserMessageAdd",{uid:uid,message:message},function(result){
			  if(result.state == "ok"){
				  layer.msg('私信发送成功！');
				  $("#message").val("");
			  }else{
				  layer.msg(result.msg);
			  }
			  //console.log(result);
		  });
	}
	
	function getQueryVariable(variable){
	       var query = window.location.search.substring(1);
	       var vars = query.split("&");
	       for (var i=0;i<vars.length;i++) {
	               var pair = vars[i].split("=");
	               if(pair[0] == variable){return pair[1];}
	       }
	       return(false);
	}
	
	$(function(){ 
	　　
		var uid=getQueryVariable("uid");
		if(uid){
			$.post("/my/sendFoundUser",{uid:uid},function(result){
				//console.log(result);
				$("#nickName").val(result.result.nickName);
			  });
		}
	});
	
	function reloadPage(){
		window.location.reload();
	}

</script>
</body>
</html>